
package clases;
import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.*;
/**
 *
 * @author Administrador
 */
public class FiltroTxtFile extends FileFilter {
     final static String txt = "txt";



    
    
    // Accept all directories and all gif, jpg, or tiff files.
    public boolean accept(File f) {

        if (f.isDirectory()) {
            return true;
            
        }

        String s = f.getName();
        int i = s.lastIndexOf('.');

        if (i > 0 &&  i < s.length() - 1) {
            String extension = s.substring(i+1).toLowerCase();
            if (txt.equals(extension)) {
                    return true;
            } else {
                return false;
            }
        }

        return false;
    }
    
    // The description of this filter
    public String getDescription() {
        return "ARCHIVOS TXT";
    }}